/*
 * Param.h
 *
 *  Created on: Dec 17, 2014
 *      Author: Phong
 */

#ifndef PARAM_H_
#define PARAM_H_

#include "Dictionary.h"
#include "Matrix.h"

#include <vector>
#include <fstream>
using namespace std;

class Param {
public:
	vector<Matrix*> weights;
	int nMatricesWoWE;
    int refCount;

	Matrix *Ww, *bw;

	Matrix *rootInner, *anonOuter;
	Matrix *anonInner[2];

	Matrix *Wih, *bi;
	vector<Matrix*> Wi[2];

	Matrix *Woh[2], *Wop[2], *bo[2];
	vector<Matrix*> Wo[2];

	Matrix *Wdr, *bdr;
	Matrix *Wpos, *Wdrpos, *bpos;

	vector<Matrix*> Wword;
	Matrix *Wdrword, *Wposword, *bword;

	Matrix *Wcap, *Wdrcap, *Wposcap, *Wwordcap, *bcap;

	vector<Matrix*> Lpos, Lcap, L;

    Param* share();
	Param (int dim, int wdim, int nwords, int npos, int ndeprel, real r1, real r2);
    static void free(Param* param);
    
	void fill(real value);
    
    void save(ofstream& f);
    static Param* load(ifstream &f);
    
private:
    ~Param();
    Param() {};
};

#endif /* PARAM_H_ */
